package com.hnas.common.service.mapper;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.hnas.common.orm.VerifyCode;
import com.hnas.common.service.dto.DTOVerifyCode;
import com.hnas.core.mapper.Mapper;

public class VerifyCodeMapper extends Mapper<DTOVerifyCode, VerifyCode>{
	private static VerifyCodeMapper mapper;
	private VerifyCodeMapper(){
		super(DTOVerifyCode.class,VerifyCode.class);
	}
	public static VerifyCodeMapper getInstance(){
		if(mapper == null){
			mapper = new VerifyCodeMapper();
		}
		return mapper;
	}
	public DTOVerifyCode mapToValue(VerifyCode vo){
		if(vo == null) return null;
		DTOVerifyCode dto = new DTOVerifyCode();
		BeanUtils.copyProperties(vo, dto);
		return dto;
	}
	public List<DTOVerifyCode> mapToValue(List<VerifyCode> list){
		if(list == null) return null;
		List<DTOVerifyCode> dtoList = new ArrayList<DTOVerifyCode>();
		for(VerifyCode vo : list){
			dtoList.add(mapToValue(vo));
		}
		return dtoList;
	}
}
